package com.anda.driver.locator.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Window;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.widget.ImageView;

import com.anda.driver.locator.R;
import com.anda.driver.locator.service.BaiduLocService;

public class SplashActivity extends Activity implements Animation.AnimationListener {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE );
		setContentView(R.layout.splash);
		ImageView imageViewSplash = (ImageView) findViewById(R.id.imageViewSplash);
		imageViewSplash.setImageResource(R.drawable.splash);
	    AlphaAnimation localAlphaAnimation = new AlphaAnimation(0.1F, 1.0F);
	    localAlphaAnimation.setDuration(1000);
	    imageViewSplash.startAnimation(localAlphaAnimation);
	    localAlphaAnimation.setAnimationListener(this);
	}
	
	public void onAnimationEnd(Animation paramAnimation)
    {
        Intent localIntent = new Intent(this, MainPageActivity.class);
        startActivity(localIntent);
        startService(new Intent(this, BaiduLocService.class));
        finish();
    }

    public void onAnimationRepeat(Animation paramAnimation)
    {
    }

    public void onAnimationStart(Animation paramAnimation)
    {
    }
}
